@(rootCategories: List[Category])(content:Html)

@****************************************
* Helper generating navigation links    *
****************************************@
@link(cat:Int) = @{

    controllers.product.routes.ProductController.list(0,cat,"asc")     
}

@**********************************
* Helper generating table headers *
***********************************@

@main("Product"){

<div class="row">
	<div class="col-md-3">
		<div class="btn-group-vertical">

  	@for(rootCat <- rootCategories){

  		@if(rootCat.hasChildren()){
  		<div class="btn-group">
  			<a href="@link(Integer.parseInt(rootCat.getId().toString()))"><button type="button" class="btn" style="min-width: 222px;">@rootCat.getName()
				</button></a>
				<button type="button" class="btn dropdown-toggle" data-toggle="dropdown">
          <span class="caret"></span>
          <span class="sr-only">Toggle Dropdown</span>
        </button>
				<ul class="dropdown-menu pull-right" role="menu">
				@for(childCat <- rootCat.getChildren()){
					<li><a href="@link(Integer.parseInt(childCat.getId().toString()))">@childCat.getName()</a></li>
				}
				</ul>
				</div>
  		}else{
  			<div class="btn-group">
  				<a href="@link(Integer.parseInt(rootCat.getId().toString()))"><button type="button" class="btn" style="min-width: 256px;">@rootCat.getName()
				</button></a>
				</div>
  		}
			
		}
</div>
	</div>
  <div class="col-md-9">
		@content
	</div>
</div>

}